#include "accountmgr.h"
#include "minutelisten.h"



AccountMgr::AccountMgr()
{
    MinuteListen::Instance()->Register(__FUNCTION__, [this](std::int64_t tick){
        m_accounts.OnTick();
    });
}

stAccount* AccountMgr::Get(const std::string& agency, const std::string& username)
{
    return m_accounts.Get(Uuid(agency,username));
}
stAccount* AccountMgr::Update(stAccount&& account)
{
    std::string uuid = account.uuid;
    return m_accounts.SetAndGet(uuid, std::move(account));
}

std::string AccountMgr::Uuid(const std::string& agency, const std::string& username)
{
    return agency + ":" + username;
}








